﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace App_Clinique.ClassLibrary.Entities
{
    public partial class Patient
    {
        public Patient()
        {
            this.PatientID = Guid.NewGuid();
            this.ToujoursEnVie = true;
            this.ToujoursDansCetteClinique = true;
            this.DateCreation = DateTime.Now;
            this.DateMiseAJour = DateTime.Now;
        }

        [Column("PatientID", Order = 0), Key]
        public virtual Guid PatientID { get; set; }

        [Column("Civilite")]
        public virtual Civilite Civilite { get; set; }

        [Column("Nom"), Required, StringLength(20)]
        public virtual String Nom { get; set; }

        [Column("Prenom"), Required, StringLength(20)]
        public virtual String Prenom { get; set; }

        [Column("Photo")]
        public virtual Byte[] Photo { get; set; }

        [Column("NumRue")]
        public virtual Int16 NumRue { get; set; }

        [Column("NomRue"), StringLength(100)]
        public virtual String NomRue { get; set; }

        [Column("ComplementAdresse"), StringLength(100)]
        public virtual String ComplementAdresse { get; set; }

        [Column("CodePostal"), StringLength(5)]
        public virtual String CodePostal { get; set; }

        [Column("Ville"), StringLength(100)]
        public virtual String Ville { get; set; }

        [Column("NumeroSecuriteSociale"), StringLength(20)]
        public virtual String NumeroSecuriteSociale { get; set; }

        [Column("ToujoursEnVie"), Required]
        public virtual Boolean ToujoursEnVie { get; set; }

        [Column("ToujoursDansCetteClinique"), Required]
        public virtual Boolean ToujoursDansCetteClinique { get; set; }

        [Column("DateCreation"), Required]
        public virtual DateTime DateCreation { get; set; }

        [Column("DateMiseAJour")]
        public virtual DateTime DateMiseAJour { get; set; }

        /****************************************************************************************************
         * Foreign Keys - IDs
         ***************************************************************************************************/
        [Column("DocumentID", Order = 1)]
        public virtual Nullable<Guid> DocumentID { get; set; }

        /****************************************************************************************************
         * Foreign Keys - Reference Objects
         ***************************************************************************************************/
        public virtual Document Document { get; set; }

        /****************************************************************************************************
         * Collections
         ***************************************************************************************************/
        public virtual ICollection<Consultation> Consultations { get; set; }
    }

    public partial class Patient
    {
        public virtual String NomComplet {
            get {
                return String.Format("{0} {1} {2}", this.Civilite.ToString(), this.Prenom, this.Nom);
            }
        }
    }
}
